<template>
  <view class="boxs">
    <div class="namelist">
      <div class="linenanme" v-for="(item, index) in list">
        <div>{{ item.username }}</div>
        <div>{{ item.created_at }}</div>

        <div>{{ item.prize_name }}</div>
      </div>
    </div>
  </view>
</template>

<script>
import request from '@/utils/request.js';
export default {
  components: {}, //注册插件
  data() {
    return {
      list: []
    }
  },
  created() {
    this.getnamelist()
  },
  async onLoad(options) {
  },
  onReady() {
  },
  methods: {
    //获取中奖名单
    async getnamelist() {
      let respons = await request({
        url: "/api/lottery/getWinRecords",
        data: { limit: 100 },//limit 每页多少条
        method: 'GET',
      })
      this.list = respons.data
    },
  }
}
</script>

<style scoped>
.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 20px;
}

.header {
  text-align: center;
  margin-bottom: 30px;
}

.header h1 {
  color: #E91E63;
  font-size: 32px;
  font-weight: 600;
  margin-bottom: 10px;
  text-shadow: 0 2px 4px rgba(233, 30, 99, 0.1);
}

.header p {
  color: #888;
  font-size: 16px;
}

.prize-card {
  background: white;
  border-radius: 12px;
  padding: 18px 20px;
  margin-bottom: 15px;
  box-shadow: 0 4px 12px rgba(233, 30, 99, 0.08);
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: transform 0.3s, box-shadow 0.3s;
  border-left: 4px solid #E91E63;
}

.prize-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(233, 30, 99, 0.12);
}

.user-info {
  flex: 1;
}

.username {
  font-weight: 600;
  font-size: 18px;
  color: #E91E63;
  margin-bottom: 5px;
}

.date {
  font-size: 14px;
  color: #888;
}

.prize-name {
  background: linear-gradient(45deg, #E91E63, #FF80AB);
  color: white;
  padding: 8px 16px;
  border-radius: 20px;
  font-weight: 500;
  font-size: 14px;
  box-shadow: 0 2px 8px rgba(233, 30, 99, 0.3);
}

.pagination {
  display: flex;
  justify-content: center;
  margin-top: 30px;
  gap: 10px;
}

.pagination button {
  background: white;
  border: 1px solid #FFCDD2;
  color: #E91E63;
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.3s;
}

.pagination button:hover:not(:disabled) {
  background: #E91E63;
  color: white;
}

.pagination button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.pagination .page-number {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
  background: white;
  border: 1px solid #FFCDD2;
  border-radius: 8px;
  font-weight: 500;
  color: #E91E63;
}

.pagination .active {
  background: #E91E63;
  color: white;
  border-color: #E91E63;
}

.loading {
  text-align: center;
  padding: 40px 0;
  color: #E91E63;
  font-size: 16px;
}

.empty {
  text-align: center;
  padding: 60px 20px;
  color: #888;
}

.empty-icon {
  font-size: 60px;
  margin-bottom: 20px;
  color: #FFCDD2;
}

@media (max-width: 600px) {
  .prize-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .prize-name {
    align-self: flex-end;
  }

  .pagination {
    flex-wrap: wrap;
  }
}
</style>